package com.mofang.activity.user;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.mofang.R;
import com.mofang.activity.BaseTitleViewActiviey;
import com.mofang.adapters.CustomerRegistrationAdapter;

public class CustomerRegistrationActivity extends BaseTitleViewActiviey {

	private ListView customer_registration_list;
	private CustomerRegistrationAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_customer_registration);
		super.onCreate(savedInstanceState);
		setNavigationTitle("客户登记表");
		setNavigationLeftBtnImage(R.drawable.return_arrow);
		setNavigationRightBtnImage(R.drawable.right_arrow);

	}

	@Override
	protected void initView() {
		super.initView();
		// TODO Auto-generated method stub
		adapter = new CustomerRegistrationAdapter(getApplicationContext());
		customer_registration_list = (ListView) findViewById(R.id.customer_registration_list);
		customer_registration_list.setAdapter(adapter);
		customer_registration_list
				.setOnItemClickListener(new OnItemClickListener() {

					@Override
					public void onItemClick(AdapterView<?> parent, View view,
							int position, long id) {
						// TODO Auto-generated method stub
						Intent intent = new Intent(getApplicationContext(),
								CustomerRegistrationDetailActivity.class);
						startActivity(intent);
					}
				});
	}

	@Override
	public void rightButtonOnClick() {
		super.rightButtonOnClick();
		 Intent intent = new Intent(getApplicationContext(),
		 CustomerRegistrationAddActivity.class);
		 startActivity(intent);
	}
}
